package ms.utils;

import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;

public class ENamedObjectContainmentEList<E extends INamedItem> extends EObjectContainmentEList<E>
	implements ENamedList<E>
{

	private static final long serialVersionUID = 1L;

	public ENamedObjectContainmentEList(Class<?> dataClass,
			InternalEObject owner, int featureID) {
		super(dataClass, owner, featureID);
	}

	@Override
	public int indexOf(String name) {
		for (int i = 0; i < size(); i++)
			if (name.equalsIgnoreCase(get(i).getName()))
				return i;
		return -1;
	}

	@Override
	public E get(String name) {
		int idx = indexOf(name);
		return idx != -1 ? super.get(idx) : null;
	}

}
